package com.zxl.manager.dao.impl;

import com.zxl.manager.dao.ApiDao;
import com.zxl.manager.entity.WxRes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

/**
 * Created by 逍遥的熊 on 2017/8/14.
 */
@Repository
public class ApiDaoImpl implements ApiDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    public int insWxEvent(WxRes wxRes,String sourceStr){
        String sql = "insert into wx_event(to_user_name,from_user_name,create_time,msg_type,event,eventkey,ticket,encrypt,source_str) values(?,?,?,?,?,?,?,?,?)";
        int res = jdbcTemplate.update(sql,new Object[]{wxRes.getToUserName(),wxRes.getFromUserName(),wxRes.getCreateTime(),wxRes.getMsgType(),
                wxRes.getEvent(),wxRes.getEventKey(),wxRes.getTicket(),wxRes.getEncrypt(),sourceStr});
        return res;
    }
}
